package com.ctgu.computer.domain.result;

import com.ctgu.computer.domain.vo.AdminLoginVO;
import com.ctgu.computer.domain.vo.NoticeVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private Integer code;
    private String message;
    private T data;

/*
    public static <T>Result<T> success(String loginSuccess, AdminLoginVO adminLoginVO){
        Result result = new Result();
        result.setCode(1);
        result.setMessage("操作成功!");
        result.setData(adminLoginVO);
        return result;
    }
*/

    public static <T>Result<T> success(){
        Result result = new Result();
        result.setCode(1);
        result.setMessage("操作成功!");
        return result;
    }

    public static <T>Result<T> success(String message,T data){
        Result result = new Result();
        result.setCode(1);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    public static <T>Result<T> success(T data){
        Result result = new Result();
        result.setCode(1);
        result.setMessage("操作成功!");
        result.setData(data);
        return result;
    }

    public static <T>Result<T> error(){
        Result result = new Result();
        result.setCode(0);
        result.setMessage("操作失败!");
        return result;
    }

    public static <T>Result<T> error(String message){
        Result result = new Result();
        result.setCode(0);
        result.setMessage(message);
        return result;
    }

//    public static <T>Result<T> success(List<T> list) {
//        Result result = new Result();
//        result.setCode(1);
//        result.setMessage("操作成功!");
//        result.setData(list);
//        return result;
//    }
}
